<template>
	<view>
	<cu-custom :isBack="true">
		<block slot="backText"></block>
		<block slot="content">{{corpCode}}-其它拣货</block>
	</cu-custom>
	<view class="content">
		<view>
			<tui-list-cell :hover="false">
				<view class="tui-line-cell">
					<view class="" style="font-size: 20px;">货位:</view>
					<input  v-model.trim="cposnames" class="tui-input" style="background: #dcdcdc;border-radius: 9px;" name="key"  maxlength="50" type="text"/>
					<view class="" style="font-size: 20px;" >存货:</view>
					<input  v-model.trim="cinvcodes" class="tui-input" style="background: #dcdcdc;border-radius: 9px;" name="key"  maxlength="50" type="text"/>
					<!-- <view class="" style="font-size: 20px;" >存货:</view>
					<input  v-model.trim="cinvnames" class="tui-input" style="background: #dcdcdc;border-radius: 9px;" name="key"  maxlength="50" type="text"/> -->
					<view style="float: right;" >
						<button class="cu-btn bg-gradual-blue shadow-blur round shadow margin-left" @click="getPosData()" data-target="DrawerModalR">查询</button>
					</view>
				</view>
			</tui-list-cell>
		</view>
		<scroll-view v-if="true" scroll-y class="data_body" >
			<view class="friend_operate">
				<senior-table :headers="dataTable.headers" :contents="invPosData"  :firstLineFixed="true"  :sortCol="dataTable.sortCol" ></senior-table>
			</view>
			<page-pagination :total="page.total" :pageSize="page.pageSize" :currentPage="page.currentPage" :showAround="true" :btnText="true" :showPageInfo="true" @change="change"></page-pagination>
			<view class="split_line"></view>
		</scroll-view>
		<view  v-else class="container padding_stand-big normal_color">
			<li class="iconfont icon-cry cry"></li>暂无数据
		</view>
	</view>
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex';
	import tuiListCell from '../../components/thorui/tui-list-cell/tui-list-cell.vue'
	import PagePagination from '../../components/page-pagination/page-pagination.vue'
	import dataTable from "../../static/json/invPosOther.json"
	import DataProgress from "../../components/data-progress/data-progress.vue"
	import SeniorTable from "../../components/data-table/senior-table.vue"
	export default {
		name:'wechat',
		props: {
			scrollHeight:{ 
				type:String,
				default:"600px"
			}
		},
		components:{
			DataProgress,
			SeniorTable,
			tuiListCell,
			PagePagination,
		},
		data() {
			return {
			   filterText: '',
			   modalName:'',
			   flName:'请选择分类',
			   mscode:'',
			   data: [{mcode:'',mname:'',childs:[]}],
			   page:{
					total: 0,  //共多少条
					pageSize: 8,//每页条数
					currentPage: 1 //第几页
				  },
				scrollTop: 0,
				delayload: false,
				Seltim: [],
				initStartDate: '',
				initEndDate: '',
				orgname:'',
				name:'',
				companyList:[],
				flList:[],
				rDate:'',
				lDate:'',
				companyName:'',
				pageSize:8,
				pageNo:1,
				list:[],
				defaultProps: {
					children: 'childs',
					label: 'mname',
				},
				dataTable,
				soDjno:'',
				invPosData: [],
				cinvcodes:'',
				cinvnames:'',
				cposnames:'',
				cwhcode: '',
				
			}
		},
		onShow() {
			
		},
		onLoad(data) {
			this.soDjno=data.soDjno;
			this.cwhcode = data.cwhcode;
			this.getPosData();
			//设置栏目宽度
			// var screenWidth=(window.screen.width-20)/(uni.upx2px(100)/100);
			// this.dataTable.headers[0].width=screenWidth/5;
			// this.dataTable.contents[0].width=this.dataTable.headers[0].width;
			// this.dataTable.headers[1].width=screenWidth/5;
			// this.dataTable.contents[1].width=this.dataTable.headers[1].width;
			
			// this.dataTable.headers[2].width=screenWidth/5;
			// this.dataTable.contents[2].width=this.dataTable.headers[2].width;
			// this.dataTable.headers[3].width=screenWidth/5;
			// this.dataTable.contents[3].width=this.dataTable.headers[3].width;
			// this.dataTable.headers[4].width=screenWidth/5;
			// this.dataTable.contents[4].width=this.dataTable.headers[4].width;
			let that = this
			
			uni.getSystemInfo({
			  success: function(res) {
			    var screenWidth=(res.windowWidth-20)/(uni.upx2px(100)/100);
			    that.dataTable.headers[0].width=screenWidth/5;
			    that.dataTable.contents[0].width=that.dataTable.headers[0].width;
			    that.dataTable.headers[1].width=screenWidth/5;
			    that.dataTable.contents[1].width=that.dataTable.headers[1].width;
			    
			    that.dataTable.headers[2].width=screenWidth/5;
			    that.dataTable.contents[2].width=that.dataTable.headers[2].width;
			    that.dataTable.headers[3].width=screenWidth/5;
			    that.dataTable.contents[3].width=that.dataTable.headers[3].width;
			    that.dataTable.headers[4].width=screenWidth/5;
			    that.dataTable.contents[4].width=that.dataTable.headers[4].width;
			  }
			});
		},
		computed: {
			...mapState(['hasLogin', 'userInfo', 'auditlist', 'corpCode']),
		},
		methods:{
			getPosData(){
				if(this.pageNo==1){
					this.list=[];
				};
				let soDjno=this.soDjno;
				//let cinvname=this.cinvnames;
				let cinvcode=this.cinvcodes;
				let cposname=this.cposnames;
				let pageSize=this.pageSize;
				let pageNo=this.pageNo;
				let cwhcode = this.cwhcode;
				uni.request({
					url:this.serverURL_a+'/wh/u8/u8InvpositionSum/findInvPosNum?__ajax=json',
					data:{
						soDjno : soDjno,
						cinvcode : cinvcode,
						cposname : cposname ,
						cwhcode  : cwhcode,
						pageSize:pageSize,
						pageNo:pageNo,
						__sid:this.userInfo.sessionid,
					},
					header: {
						'content-type': 'application/x-www-form-urlencoded;charset=utf-8',
					},
					method: 'POST',
					success:function(data){
						let ret = data.data;
						//获取总条数，其余显示插件自动计算
						this.page.total = ret.count;
						if(data.statusCode!="200"){
							uni.showModal({
								content: ret.message,
								showCancel:false,
							});
							return;
						}
						this.invPosData = ret.list;
					}.bind(this),
					fail:function(){
						this.$api.msg('服务已停止,请稍后再试');
						return;
					}.bind(this),
				});
			},
			showModal(e) {
				this.modalName = e.currentTarget.dataset.target
			},
			hideModal(e) {
				this.modalName = null
			},
			change(currentPage, type){
			      this.page.currentPage = currentPage;
				  this.pageNo= this.page.currentPage;
				  this.getPosData();
			},
		}
	}
</script>

<style scoped lang="less">
	.cu-dialog{
		    height: 300px;
		    overflow: auto;
	}
	.content{
		padding-top: 10rpx;
		.progress,.firend_operate{
			padding: 0 10rpx;
		}
		.progress{
			margin-bottom: 20rpx;
		}
		.friend_operate{
			padding: 30rpx 20rpx;
			.title{
				text-align:left;
				margin-bottom: 30rpx;
				font-size: 40rpx;
			}
			.trend_title{
				text-align: right;
				font-size: 22rpx;
				color: #ff9900;
				margin-top: 50rpx;
			}
		}
	}
	
	.ly-search {
		margin: 0 30rpx;
		margin-top: 40rpx;
		padding-bottom: 15rpx;
		border-bottom: 1px solid #ededed;
	}
	.container {
		padding: 20rpx 0 50rpx 0;
	}
	
	.tui-line-cell {
		width: 100%;
		box-sizing: border-box;
		display: flex;
		align-items: center;
	}
	
	.tui-title {
		line-height: 32rpx;
		min-width: 120rpx;
		flex-shrink: 0;
	}
	
	.tui-input {
		font-size: 32rpx;
		color: #333;
		padding-left: 20rpx;
		flex: 1;
		overflow: visible;
	}
	
	.radio-group {
		margin-left: auto;
		transform: scale(0.8);
		transform-origin: 100% center;
		flex-shrink: 0;
	}
	
	.tui-radio {
		display: inline-block;
		padding-left: 28rpx;
		font-size: 36rpx;
		vertical-align: middle;
	}
	
	
	.tui-btn-box {
		padding: 40rpx 50rpx;
		box-sizing: border-box;
	}
	
	.tui-button-gray {
		margin-top: 30rpx;
	}
	
	.tui-tips {
		padding: 30rpx;
		color: #999;
		font-size: 24rpx;
	}
	
	.d-container {
		width: 400rpx;
		padding: 80rpx 30rpx;
	}
	
	.usingtext{
		margin-left: 30rpx;
		color: #999;
	}
	
	.tui-right {
		margin-left: auto;
		padding-right: 30rpx;
		color: #999;
	}
	
	.numtext{
		text-align: center;
	}
</style>
